/*
 * @Author: NJ_1098 xiabaoxin
 * @Date: 2025-02-13 17:20:01
 * @LastEditors: NJ_1098 xiabaoxin
 * @LastEditTime: 2025-02-19 17:19:56
 * @Description: 账单路由
 */
const Router = require("koa-router");
const router = new Router({ prefix: "/bill" });
const UserMiddleware = require("../middleware/user.middleware");
const BillMiddleware = require("../middleware/bill.middleware");
const BillController = require("../controller/bill.controller");

/**
 * @author: NJ_1098 xiabaoxin
 * @description: 新增账单
 * @return {*}
 */
router.post(
  "/add",
  UserMiddleware.verifyToken,
  BillMiddleware.addOptionValidate,
  BillController.add
);

/**
 * @author: NJ_1098 xiabaoxin
 * @description: 删除账单
 * @return {*}
 */
router.post(
  "/delete",
  UserMiddleware.verifyToken,
  BillMiddleware.deleteValidate,
  BillController.delete
);

/**
 * @author: NJ_1098 xiabaoxin
 * @description: 账单列表
 * @return {*}
 */
router.get("/list", UserMiddleware.verifyToken, BillController.list);

/**
 * @author: NJ_1098 xiabaoxin
 * @description: 账单详情
 * @return {*}
 */
router.get(
  "/detail",
  UserMiddleware.verifyToken,
  BillMiddleware.detailValidate,
  BillController.detail
);

/**
 * @author: NJ_1098 xiabaoxin
 * @description: 账单更新
 * @return {*}
 */
router.post(
  "/update",
  UserMiddleware.verifyToken,
  BillMiddleware.updateValidate,
  BillController.update
);

module.exports = router;
